package de.jmda.core.util.fileset;

import java.io.File;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * Accepts existing directories and existing .jar files only.
 *
 *
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class FileFilterDirectoriesAndJarsOnly extends FileFilterBase
{
	public boolean accept(File file)
	{
		if (file.exists())
		{
			if (file.isDirectory())
			{
				return true;
			}
			else if (file.getAbsolutePath().endsWith(".jar"))
			{
				return true;
			}
		}
		return false;
	}

	@Override
  public String getDescription()
  {
		return "directories and .jar files only";
  }
}